<template>
  <el-dropdown size="small" class="d2-mr">
    <span class="btn-text">{{
        info.name ? `你好 ${info.name}` : "未登录"
    }}</span>
    <el-dropdown-menu slot="dropdown">
      <el-dropdown-item @click.native="userInfo">
        <d2-icon name="cog" class="d2-mr-5" />个人信息
      </el-dropdown-item>
      <el-dropdown-item @click.native="logOff" divided>
        <d2-icon name="power-off" class="d2-mr-5" />
        注销
      </el-dropdown-item>
    </el-dropdown-menu>
    <el-image v-if="info.avatar" :src="info.avatar" :preview-src-list="[info.avatar]" style="width: 20px;height: 20px"
      alt="头像"></el-image>
  </el-dropdown>
</template>

<script>
// import { mapState, mapActions } from 'vuex'
export default {
  // computed: {
  //   ...mapState('d2admin/user', ['info'])
  // },
  // methods: {
  //   ...mapActions('d2admin/account', ['logout']),
  //   /**
  //    * @description 登出
  //    */
  //   logOff () {
  //     this.logout({
  //       confirm: true
  //     })
  //   },
  //   /** 个人信息 */
  //   userInfo () {
  //     this.$router.push({ path: 'userInfo' })
  //   }
  // }
}
</script>
